<TABLE class=design bgColor=#ffffff cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR="#C0C0C0" STYLE="border-collapse: collapse">
<?php
	if(!isset($_POST)){
		extract($HTTP_POST_VARS);
		extract($HTTP_GET_VARS);
		extract($HTTP_COOKIE_VARS);
		extract($HTTP_ENV_VARS);
		extract($HTTP_SERVER_VARS);
	}else{
		extract($_POST);
		extract($_GET);
		extract($_COOKIE);
		extract($_ENV);
		extract($_SERVER);
	}
	if($what == 'process'){
?>
<tr>
	<td colspan=3>
<?
		$goToIt = 1;
		if($goToIt){
			// Connected to the database server OK
			$query = mysql_query("SELECT count(*) FROM users WHERE username = '{$strUserName}' AND uid != $uid");
			if(mysql_result($query, 0, 0) == 0){
				if ($strPassword){
					$password = md5($strPassword);
				}
				$strQuery  = "UPDATE users SET ";
				$strQuery .= "username='{$strUserName}', "; 
				if ($password){
					$strQuery .= "password='$strPassword', ";
				}
				$strQuery .= "email='{$stremail}', "; 
				$strQuery .= "egold='{$stregold}' ";
				$strQuery .= " WHERE uid=$uid ";
				if(mysql_query($strQuery)){
?>
					<span class="title">User Updated</span><br><br>
					You have sucsessfully updated this user.
					<a href="<?=$PHP_SELF?>?a=<?=$a?>">Continue</a>
<?php
				}
			}else{
?>
				<span class="title">Error</span><br><br>
				The username you have choosen is already used. Please select another username.<br>
				Please use the link below to return.<br><br>
				<a href="javascript:history.back(-1);">Back</a>
<?php
			}
		}else{
	?>
			<span class="title">Error</span><br><br>
			Sorry, but the passwords you supplied did not match. Please use the link below to return.<br><br>
			<a href="javascript:history.back(-1);">Back</a>
<?php
		}
?>
	</td>
</tr>
<?
	}else{
		$sql = "SELECT * FROM users WHERE uid=$uid";
		$qr1 = mysql_query($sql);
		extract( mysql_fetch_array($qr1) );
?>
		<form action="<?=$PHP_SELF?>" method="post" name="form1">
		<input type="hidden" name="what" value="process">
		<input type="hidden" name="a" value="<?=$a?>">
		<input type="hidden" name="step" value="<?=$step?>">
		<input type="hidden" name="uid" value="<?=$uid?>">
		<tr>
			<td colspan="3">
				<div align="center"><strong><font color="#0066CC" size="3" face="Verdana, Arial, Helvetica, sans-serif">Edit User</font></strong></div>
			</td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">UserName&nbsp;&nbsp;</strong>
			</td>
			<td><input type="text" name="strUserName" value="<?=$username?>"></td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password&nbsp;&nbsp;</strong>
			</td>
			<td><input type="text" name="strPassword" value="<?=$password?>"></td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email&nbsp;&nbsp;</strong>
			</td>
			<td><input type="text" name="stremail" value="<?=$email?>"></td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">E-Gold&nbsp;&nbsp;</strong>
			</td>
			<td><input type="text" name="stregold" value="<?=$egold?>"></td>
		</tr>
		<tr>
			<td colspan="3"><hr width="100%" size="1" color="#66B0DC"></td>
		</tr>
		<tr>
			<td colspan="3">
				<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
					<input type="submit" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
					<input type="reset" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
				</font></div>
			</td>
		</tr>
		</form>
<?php
	}
?>
</table>